package com.lg.utils.hutool.url;

import cn.hutool.core.util.URLUtil;

import java.net.URL;

public class URLUtilTest {
    public static void main(String[] args) {
        String url = "http://www.hutool.cn//aaa/bbb";
        // 结果为：http://www.hutool.cn/aaa/bbb
        String normalize = URLUtil.normalize(url);
        System.out.println(normalize);


        url = "www.hutool.cn//aaa/\\bbb?a=1&b=2";
        // 结果为：http://c:/www.hutool.cn//aaa//bbb?a=1&b=2
        normalize = URLUtil.normalize(url);
        System.out.println(normalize);

        String body = "366466 - 副本.jpg";

        String str = "http://192.168.21.77:8310/tilecache/service/wmts?layer=%E5%85%A8%E7%90%83-JPEG-4326&tilematrixset=EPSG%3A4326&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fjpeg&TileMatrix=EPSG%3A4326%3A1&TileCol=2&TileRow=1\n";
        System.out.println(URLUtil.encode(body));
        System.out.println(URLUtil.decode(str));
        System.out.println();
        System.out.println();

        URL url1 = URLUtil.url(str);
        System.out.println(url1);
        System.out.println(URLUtil.getHost(URLUtil.url(str)));
        System.out.println(URLUtil.getPath(str));
        System.out.println(URLUtil.getContentLength(url1));



    }
}
